import request from '@/utils/request.js'

export const getCateListAPI = () => {
  return request.get('/my/cate/list')
}

export const addCateAPI = (obj) => {
  return request.post('/my/cate/add', obj)
}

export const updateCateAPI = (obj) => {
  return request.put('/my/cate/info', obj)
}

export const deleteCateAPI = (id) => {
  return request.delete('/my/cate/del', {
    params: { id }
  })
}

// 发表文章的API接口
// 注意：形参中fd是FormData格式的请求体对象
export const pubArticleAPI = (fd) => {
  return request.post('/my/article/add', fd)
}

// 获取文章列表的API接口
export const getArtListAPI = (obj) => {
  return request.get('/my/article/list', {
    params: obj
  })
}

// 获取文章详情的API接口
export const getArticleAPI = (id) => {
  return request.get('/my/article/info', {
    params: { id: id }
  })
}

// 删除文章
export const deleteArticle = (id) => {
  return request.delete('/my/article/info', {
    params: { id }
  })
}
